home *** CD-ROM | disk | FTP | other *** search
- /*
- * (c) Copyright 1992 by Panagiotis Tsirigotis
- * All rights reserved. The file named COPYRIGHT specifies the terms
- * and conditions for redistribution.
- */
-
- #ifndef SERVER_H
- #define SERVER_H
-
- /*
- * $Id: server.h,v 5.1 1992/10/31 23:59:07 panos Exp $
- */
-
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <netinet/in.h> /* for sockaddr_in */
-
- #include "defs.h"
- #include "service.h"
- #include "connection.h"
-
- /*
- * This struct describes running servers
- */
- struct server
- {
- pid_t pid ;
- time_t start_time ;
- connection_s *cp ;
- struct service *sp ; /* service that owns this server */
- int fork_failures ; /* number of fork(2) failures */
- int exit_status ;
- bool_int log_remote_user ;
- bool_int writes_to_log ; /* needed because a service may be */
- /* reconfigured between server forking */
- /* and exit */
- } ;
-
- #define SERP( p ) ((struct server *)(p))
-
- #define SERVER_SERVICE( serp ) (serp)->sp
- #define SERVER_CONNECTION(serp) (serp)->cp
- #define SERVER_FD( serp ) conn_descriptor( (serp)->cp )
-
- status_e server_init() ;
- struct server *server_alloc() ;
- void server_release() ;
- status_e server_run() ;
- status_e server_start() ;
- void server_cleanup() ;
- void server_dump() ;
- void server_postmortem() ;
-
-
- /*
- * Macros for compatibility
- */
- #ifndef OLD_WAIT
- #define PROC_EXITED( s ) WIFEXITED( s )
- #define PROC_SIGNALED( s ) WIFSIGNALED( s )
- #define PROC_STOPPED( s ) WIFSTOPPED( s )
- #define PROC_EXITSTATUS( s ) WEXITSTATUS( s )
- #define PROC_TERMSIG( s ) WTERMSIG( s )
- #else
- #define PROC_EXITED( s ) WIFEXITED( *(union wait *)&(s) )
- #define PROC_SIGNALED( s ) WIFSIGNALED( *(union wait *)&(s) )
- #define PROC_STOPPED( s ) WIFSTOPPED( *(union wait *)&(s) )
- #define PROC_EXITSTATUS( s ) (((union wait *)&(s))->w_T.w_Retcode)
- #define PROC_TERMSIG( s ) (((union wait *)&(s))->w_T.w_Termsig)
- #endif /* OLD_WAIT */
-
- #endif /* SERVER_H */
-
-